<html lang="en-US">

<head>
    
<title>Go 的 fake-useragent 了解一下 - 花落雨忧</title>

<meta property="og:title" content="Go 的 fake-useragent 了解一下 - 花落雨忧">



    



    
    <meta property="description" content="有的网站会根据 User-Agent 的不同，跳转到不同（PC、M）的站点，也有根据版本的不同给出不一样的提示等等，而 User-Agent 的变化更是爬虫里的基础姿势
使用 Go 编写网络爬虫或需要模拟浏览器头（User-Agent）的时候，你是否会觉得很麻烦，获取请求头（Request Headers）的 User-Agent 还得找来找去，挺繁琐。先前我也遇到了这个问题， &amp;hellip;">
    <meta property="og:description" content="有的网站会根据 User-Agent 的不同，跳转到不同（PC、M）的站点，也有根据版本的不同给出不一样的提示等等，而 User-Agent 的变化更是爬虫里的基础姿势
使用 Go 编写网络爬虫或需要模拟浏览器头（User-Agent）的时候，你是否会觉得很麻烦，获取请求头（Request Headers）的 User-Agent 还得找来找去，挺繁琐。先前我也遇到了这个问题， &amp;hellip;">
    






<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1">

<link rel="shortcut icon" href="https://www.lican.asia/logo/logo.png" type="image/x-icon" />



<link rel="stylesheet" href="/css/style.min.css" />

<link rel="stylesheet" href="/css/reset.min.css" />




<script src="https://www.lican.asia/js/highlight.min.js"></script>

<script>
hljs.configure({ ignoreUnescapedHTML: true })
hljs.highlightAll();
</script>


<script src="https://www.lican.asia/js/jquery.min.js"></script>




<link href="https://www.lican.asia/css/hugo-code.min.css" rel="stylesheet" />



    <style>
        .post-content img {
            max-width: 400px;
        }
    </style>
</head>

<body id="period" class="home blog">
    <a class="skip-content" href="#main">Press "Enter" to skip to content</a>
    <div id="overflow-container" class="overflow-container">
        <header class="site-header" id="site-header" role="banner">
    <div class="max-width">
        <div id="title-container" class="title-container">
            <div id="site-title" class="site-title"><a href="/">花落雨忧</a></div>
            <p class="tagline">思所及 力所行 方为真.</p>
        </div>
        
        <div id="menu-primary-container" class="menu-primary-container">
            <div class="icon-container">
            </div>
            <div id="menu-primary" class="menu-container menu-primary" role="navigation">
                <nav class="menu">
                    <ul id="menu-primary-items" class="menu-primary-items">
                        
                        
                        <li id="menu-item-0"
                            class="menu-item menu-item-type-custom menu-item-object-custom ">
                            <a href="/posts" aria-current="page" tabindex="0">首页</a></li>
                        
                        <li id="menu-item-1"
                            class="menu-item menu-item-type-custom menu-item-object-custom ">
                            <a href="/tech/" aria-current="page" tabindex="1">技术文档</a></li>
                        
                        <li id="menu-item-2"
                            class="menu-item menu-item-type-custom menu-item-object-custom ">
                            <a href="/article/" aria-current="page" tabindex="2">文章</a></li>
                        
                        <li id="menu-item-3"
                            class="menu-item menu-item-type-custom menu-item-object-custom ">
                            <a href="/project/" aria-current="page" tabindex="3">项目</a></li>
                        
                        <li id="menu-item-4"
                            class="menu-item menu-item-type-custom menu-item-object-custom ">
                            <a href="/about/" aria-current="page" tabindex="4">关于</a></li>
                        
                    </ul>
                </nav>
            </div>
        </div>
    </div>
</header>

        <div id="primary-container" class="primary-container">
            <div class="max-width">
                <section id="main" class="main" role="main">
                    <div id="loop-container" class="loop-container">
                        <div
                            class="post type-post status-publish format-standard hentry entry">
                            <article>
                                <div class="post-container">
                                    <div class="post-header">
                                        <h2 class="post-title">
                                            <a href="/posts/posts/go/talk/2018-05-21-go-fake-useragent/">Go 的 fake-useragent 了解一下</a>
                                        </h2>
                                        
                                        <div class="post-byline">Published on
                                            <a class="date" href="javascript:;">2018/05/21</a>
                                            
                                            
                                            
                                            By 
                                            <a class="author" href="javascript:;">煎鱼</a></div>
                                            
                                        
                                    </div>
                                    <div class="post-content">
                                        <p>有的网站会根据 User-Agent 的不同，跳转到不同（PC、M）的站点，也有根据版本的不同给出不一样的提示等等，而 User-Agent 的变化更是爬虫里的基础姿势</p>
<p>使用 Go 编写网络爬虫或需要模拟浏览器头（User-Agent）的时候，你是否会觉得很麻烦，获取请求头（Request Headers）的 User-Agent 还得找来找去，挺繁琐。先前我也遇到了这个问题，因此有了这个项目 <a href="https://github.com/EDDYCJY/fake-useragent">fake-useragent</a>，用来解决你我的痛点</p>
<p>项目地址：https://github.com/EDDYCJY/fake-useragent</p>
<h2 id="支持">支持</h2>
<ul>
<li>All User-Agent Random</li>
<li>Chrome</li>
<li>InternetExplorer (IE)</li>
<li>Firefox</li>
<li>Safari</li>
<li>Android</li>
<li>MacOSX</li>
<li>IOS</li>
<li>Linux</li>
<li>IPhone</li>
<li>IPad</li>
<li>Computer</li>
<li>Mobile</li>
</ul>
<h2 id="安装">安装</h2>
<pre tabindex="0"><code>$ go get github.com/EDDYCJY/fake-useragent
</code></pre><h2 id="用法">用法</h2>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-go" data-lang="go"><span style="display:flex;"><span><span style="color:#f92672">package</span> <span style="color:#a6e22e">main</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">import</span> (
</span></span><span style="display:flex;"><span>	<span style="color:#e6db74">&#34;log&#34;</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>	<span style="color:#e6db74">&#34;github.com/EDDYCJY/fake-useragent&#34;</span>
</span></span><span style="display:flex;"><span>)
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">func</span> <span style="color:#a6e22e">main</span>() {
</span></span><span style="display:flex;"><span>	<span style="color:#75715e">// 推荐使用
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>	<span style="color:#a6e22e">random</span> <span style="color:#f92672">:=</span> <span style="color:#a6e22e">browser</span>.<span style="color:#a6e22e">Random</span>()
</span></span><span style="display:flex;"><span>	<span style="color:#a6e22e">log</span>.<span style="color:#a6e22e">Printf</span>(<span style="color:#e6db74">&#34;Random: %s&#34;</span>, <span style="color:#a6e22e">random</span>)
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>	<span style="color:#a6e22e">chrome</span> <span style="color:#f92672">:=</span> <span style="color:#a6e22e">browser</span>.<span style="color:#a6e22e">Chrome</span>()
</span></span><span style="display:flex;"><span>	<span style="color:#a6e22e">log</span>.<span style="color:#a6e22e">Printf</span>(<span style="color:#e6db74">&#34;Chrome: %s&#34;</span>, <span style="color:#a6e22e">chrome</span>)
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>	<span style="color:#a6e22e">internetExplorer</span> <span style="color:#f92672">:=</span> <span style="color:#a6e22e">browser</span>.<span style="color:#a6e22e">InternetExplorer</span>()
</span></span><span style="display:flex;"><span>	<span style="color:#a6e22e">log</span>.<span style="color:#a6e22e">Printf</span>(<span style="color:#e6db74">&#34;IE: %s&#34;</span>, <span style="color:#a6e22e">internetExplorer</span>)
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>	<span style="color:#a6e22e">firefox</span> <span style="color:#f92672">:=</span> <span style="color:#a6e22e">browser</span>.<span style="color:#a6e22e">Firefox</span>()
</span></span><span style="display:flex;"><span>	<span style="color:#a6e22e">log</span>.<span style="color:#a6e22e">Printf</span>(<span style="color:#e6db74">&#34;Firefox: %s&#34;</span>, <span style="color:#a6e22e">firefox</span>)
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>	<span style="color:#a6e22e">safari</span> <span style="color:#f92672">:=</span> <span style="color:#a6e22e">browser</span>.<span style="color:#a6e22e">Safari</span>()
</span></span><span style="display:flex;"><span>	<span style="color:#a6e22e">log</span>.<span style="color:#a6e22e">Printf</span>(<span style="color:#e6db74">&#34;Safari: %s&#34;</span>, <span style="color:#a6e22e">safari</span>)
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>	<span style="color:#a6e22e">android</span> <span style="color:#f92672">:=</span> <span style="color:#a6e22e">browser</span>.<span style="color:#a6e22e">Android</span>()
</span></span><span style="display:flex;"><span>	<span style="color:#a6e22e">log</span>.<span style="color:#a6e22e">Printf</span>(<span style="color:#e6db74">&#34;Android: %s&#34;</span>, <span style="color:#a6e22e">android</span>)
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>	<span style="color:#a6e22e">macOSX</span> <span style="color:#f92672">:=</span> <span style="color:#a6e22e">browser</span>.<span style="color:#a6e22e">MacOSX</span>()
</span></span><span style="display:flex;"><span>	<span style="color:#a6e22e">log</span>.<span style="color:#a6e22e">Printf</span>(<span style="color:#e6db74">&#34;MacOSX: %s&#34;</span>, <span style="color:#a6e22e">macOSX</span>)
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>	<span style="color:#a6e22e">ios</span> <span style="color:#f92672">:=</span> <span style="color:#a6e22e">browser</span>.<span style="color:#a6e22e">IOS</span>()
</span></span><span style="display:flex;"><span>	<span style="color:#a6e22e">log</span>.<span style="color:#a6e22e">Printf</span>(<span style="color:#e6db74">&#34;IOS: %s&#34;</span>, <span style="color:#a6e22e">ios</span>)
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>	<span style="color:#a6e22e">linux</span> <span style="color:#f92672">:=</span> <span style="color:#a6e22e">browser</span>.<span style="color:#a6e22e">Linux</span>()
</span></span><span style="display:flex;"><span>	<span style="color:#a6e22e">log</span>.<span style="color:#a6e22e">Printf</span>(<span style="color:#e6db74">&#34;Linux: %s&#34;</span>, <span style="color:#a6e22e">linux</span>)
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>	<span style="color:#a6e22e">iphone</span> <span style="color:#f92672">:=</span> <span style="color:#a6e22e">browser</span>.<span style="color:#a6e22e">IPhone</span>()
</span></span><span style="display:flex;"><span>	<span style="color:#a6e22e">log</span>.<span style="color:#a6e22e">Printf</span>(<span style="color:#e6db74">&#34;IPhone: %s&#34;</span>, <span style="color:#a6e22e">iphone</span>)
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>	<span style="color:#a6e22e">ipad</span> <span style="color:#f92672">:=</span> <span style="color:#a6e22e">browser</span>.<span style="color:#a6e22e">IPad</span>()
</span></span><span style="display:flex;"><span>	<span style="color:#a6e22e">log</span>.<span style="color:#a6e22e">Printf</span>(<span style="color:#e6db74">&#34;IPad: %s&#34;</span>, <span style="color:#a6e22e">ipad</span>)
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>	<span style="color:#a6e22e">computer</span> <span style="color:#f92672">:=</span> <span style="color:#a6e22e">browser</span>.<span style="color:#a6e22e">Computer</span>()
</span></span><span style="display:flex;"><span>	<span style="color:#a6e22e">log</span>.<span style="color:#a6e22e">Printf</span>(<span style="color:#e6db74">&#34;Computer: %s&#34;</span>, <span style="color:#a6e22e">computer</span>)
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>	<span style="color:#a6e22e">mobile</span> <span style="color:#f92672">:=</span> <span style="color:#a6e22e">browser</span>.<span style="color:#a6e22e">Mobile</span>()
</span></span><span style="display:flex;"><span>	<span style="color:#a6e22e">log</span>.<span style="color:#a6e22e">Printf</span>(<span style="color:#e6db74">&#34;Mobile: %s&#34;</span>, <span style="color:#a6e22e">mobile</span>)
</span></span><span style="display:flex;"><span>}
</span></span></code></pre></div><h3 id="定制">定制</h3>
<p>你可以调整抓取数据源的最大页数、时间间隔以及最大超时时间。 如果不填写，则为默认值。</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-go" data-lang="go"><span style="display:flex;"><span><span style="color:#a6e22e">client</span> <span style="color:#f92672">:=</span> <span style="color:#a6e22e">browser</span>.<span style="color:#a6e22e">Client</span>{
</span></span><span style="display:flex;"><span>	<span style="color:#a6e22e">MaxPage</span>: <span style="color:#ae81ff">3</span>,
</span></span><span style="display:flex;"><span>	<span style="color:#a6e22e">Delay</span>: <span style="color:#ae81ff">200</span> <span style="color:#f92672">*</span> <span style="color:#a6e22e">time</span>.<span style="color:#a6e22e">Millisecond</span>,
</span></span><span style="display:flex;"><span>	<span style="color:#a6e22e">Timeout</span>: <span style="color:#ae81ff">10</span> <span style="color:#f92672">*</span> <span style="color:#a6e22e">time</span>.<span style="color:#a6e22e">Second</span>,
</span></span><span style="display:flex;"><span>}
</span></span><span style="display:flex;"><span><span style="color:#a6e22e">cache</span> <span style="color:#f92672">:=</span> <span style="color:#a6e22e">browser</span>.<span style="color:#a6e22e">Cache</span>{}
</span></span><span style="display:flex;"><span><span style="color:#a6e22e">b</span> <span style="color:#f92672">:=</span> <span style="color:#a6e22e">browser</span>.<span style="color:#a6e22e">NewBrowser</span>(<span style="color:#a6e22e">client</span>, <span style="color:#a6e22e">cache</span>)
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#a6e22e">random</span> <span style="color:#f92672">:=</span> <span style="color:#a6e22e">b</span>.<span style="color:#a6e22e">Random</span>()
</span></span></code></pre></div><p>更新浏览器头的临时文件缓存</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-go" data-lang="go"><span style="display:flex;"><span><span style="color:#a6e22e">client</span> <span style="color:#f92672">:=</span> <span style="color:#a6e22e">browser</span>.<span style="color:#a6e22e">Client</span>{}
</span></span><span style="display:flex;"><span><span style="color:#a6e22e">cache</span> <span style="color:#f92672">:=</span> <span style="color:#a6e22e">browser</span>.<span style="color:#a6e22e">Cache</span>{
</span></span><span style="display:flex;"><span>	<span style="color:#a6e22e">UpdateFile</span>: <span style="color:#66d9ef">true</span>,
</span></span><span style="display:flex;"><span>}
</span></span><span style="display:flex;"><span><span style="color:#a6e22e">b</span> <span style="color:#f92672">:=</span> <span style="color:#a6e22e">browser</span>.<span style="color:#a6e22e">NewBrowser</span>(<span style="color:#a6e22e">client</span>, <span style="color:#a6e22e">cache</span>)
</span></span></code></pre></div><p><strong>最后，建议常规用法就好，默认参数能够满足日常需求</strong></p>
<h2 id="输出">输出</h2>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-sh" data-lang="sh"><span style="display:flex;"><span>Random: Mozilla/5.0 <span style="color:#f92672">(</span>Macintosh; Intel Mac OS X 10_13_2<span style="color:#f92672">)</span> AppleWebKit/537.36 <span style="color:#f92672">(</span>KHTML, like Gecko<span style="color:#f92672">)</span> Chrome/63.0.3239.132 Safari/537.36
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>Chrome: Mozilla/5.0 <span style="color:#f92672">(</span>Windows NT 10.0; Win64; x64<span style="color:#f92672">)</span> AppleWebKit/537.36 <span style="color:#f92672">(</span>KHTML, like Gecko<span style="color:#f92672">)</span> Chrome/60.0.3112.113 Safari/537.36
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>IE: Mozilla/5.0 <span style="color:#f92672">(</span>compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>Firefox: Mozilla/5.0 <span style="color:#f92672">(</span>Windows NT 6.3; WOW64; rv:41.0<span style="color:#f92672">)</span> Gecko/20100101 Firefox/41.0
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>Safari: Mozilla/5.0 <span style="color:#f92672">(</span>iPhone; CPU iPhone OS 11_2_5 like Mac OS X<span style="color:#f92672">)</span> AppleWebKit/604.5.6 <span style="color:#f92672">(</span>KHTML, like Gecko<span style="color:#f92672">)</span> Version/11.0 Mobile/15D60 Safari/604.1
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>Android: Mozilla/5.0 <span style="color:#f92672">(</span>Linux; Android 6.0; MYA-L22 Build/HUAWEIMYA-L22<span style="color:#f92672">)</span> AppleWebKit/537.36 <span style="color:#f92672">(</span>KHTML, like Gecko<span style="color:#f92672">)</span> Chrome/62.0.3202.84 Mobile Safari/537.36
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>MacOSX: Mozilla/5.0 <span style="color:#f92672">(</span>Macintosh; Intel Mac OS X 10_10_5<span style="color:#f92672">)</span> AppleWebKit/602.2.14 <span style="color:#f92672">(</span>KHTML, like Gecko<span style="color:#f92672">)</span> Version/10.0.1 Safari/602.2.14
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>IOS: Mozilla/5.0 <span style="color:#f92672">(</span>iPhone; CPU iPhone OS 10_1 like Mac OS X<span style="color:#f92672">)</span> AppleWebKit/602.2.14 <span style="color:#f92672">(</span>KHTML, like Gecko<span style="color:#f92672">)</span> Version/10.0 Mobile/14B72 Safari/602.1
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>Linux: Mozilla/5.0 <span style="color:#f92672">(</span>X11; Linux x86_64; rv:42.0<span style="color:#f92672">)</span> Gecko/20100101 Firefox/42.0
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>IPhone: Mozilla/5.0 <span style="color:#f92672">(</span>iPhone; CPU iPhone OS 10_2 like Mac OS X<span style="color:#f92672">)</span> AppleWebKit/602.3.12 <span style="color:#f92672">(</span>KHTML, like Gecko<span style="color:#f92672">)</span> Version/10.0 Mobile/14C92 Safari/602.1
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>IPad: Mozilla/5.0 <span style="color:#f92672">(</span>iPad; CPU OS 5_0_1 like Mac OS X<span style="color:#f92672">)</span> AppleWebKit/534.46 <span style="color:#f92672">(</span>KHTML, like Gecko<span style="color:#f92672">)</span> Version/5.1 Mobile/9A405 Safari/7534.48.3
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>Computer: Mozilla/5.0 <span style="color:#f92672">(</span>Windows NT 10.0; WOW64; rv:54.0<span style="color:#f92672">)</span> Gecko/20100101 Firefox/54.0
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>Mobile: Mozilla/5.0 <span style="color:#f92672">(</span>Linux; Android 7.0; Redmi Note <span style="color:#ae81ff">4</span> Build/NRD90M<span style="color:#f92672">)</span> AppleWebKit/537.36 <span style="color:#f92672">(</span>KHTML, like Gecko<span style="color:#f92672">)</span> Chrome/63.0.3239.111 Mobile Safari/537.36
</span></span></code></pre></div><h2 id="注意">注意</h2>
<p>如果第一次使用，<a href="https://github.com/EDDYCJY/fake-useragent">fake-useragent</a> 将收集数据并在临时目录中创建一个文件作为文件缓存，请耐心等待几秒钟</p>
<h2 id="最后">最后</h2>
<p>如果在项目中发现了什么问题，欢迎提交 PR 或者 issue。希望你能够喜欢这个项目，根本目的还是为了解决痛点，欢迎 Star！😁</p>
<hr>
<p>项目地址：https://github.com/EDDYCJY/fake-useragent</p>


                                        
                                        
                                        
                                        <div class="rp4wp-related-posts">
                                            <h3>相关文章</h3>
                                            <ul>
                                                
                                                <li>
                                                    <div class="rp4wp-related-post-content">
                                                        <a
                                                            href="https://www.lican.asia/posts/posts/go/gin/2018-04-29-cron/">「连载十一」Cron定时任务</a>
                                                    </div>
                                                </li>
                                                
                                                <li>
                                                    <div class="rp4wp-related-post-content">
                                                        <a
                                                            href="https://www.lican.asia/posts/posts/go/crawler/2018-04-28-go2018/">了解一下Golang的市场行情</a>
                                                    </div>
                                                </li>
                                                
                                                <li>
                                                    <div class="rp4wp-related-post-content">
                                                        <a
                                                            href="https://www.lican.asia/posts/posts/go/gin/2018-04-15-gorm-callback/">「连载十」定制 GORM Callbacks</a>
                                                    </div>
                                                </li>
                                                
                                                <li>
                                                    <div class="rp4wp-related-post-content">
                                                        <a
                                                            href="https://www.lican.asia/posts/posts/go/crawler/2018-04-01-cars/">爬取汽车之家 二手车产品库</a>
                                                    </div>
                                                </li>
                                                
                                                <li>
                                                    <div class="rp4wp-related-post-content">
                                                        <a
                                                            href="https://www.lican.asia/posts/posts/go/gin/2018-03-26-cgo/">「番外」Golang 交叉编译</a>
                                                    </div>
                                                </li>
                                                
                                            </ul>
                                        </div>
                                        
                                        
                                    </div>

                                    
                                    
                                    

                                    
                                    <div class="post-meta">
                                        
                                        
                                        <div class="post-tags">
                                            <ul>
                                            
                                            <li>
                                                <a href="/tags/go" title="View all posts tagged match">go</a>
                                            </li>
                                            
                                            </ul>
                                        </div>
                                        
                                        
                                        <nav class="further-reading">
                                            
                                            <div class="previous">
                                                <span>&lt;&lt; Prev</span>
                                                <a href="https://www.lican.asia/posts/posts/go/gin/2018-04-29-cron/"
                                                    rel="prev">「连载十一」Cron定时任务</a> </div>
                                            
                                            
                                            <div class="next">
                                                <span>Next >></span>
                                                <a href="https://www.lican.asia/posts/posts/go/gin/2018-05-27-config-upload/">「连载十二」优化配置结构及实现图片上传</a> 
                                            </div>
                                            
                                        </nav>
                                    </div>
                                    
                                    

                                    
                                    
                                    

                                </div>
                            </article>
                        </div>
                    </div>
                </section>
                <aside class="sidebar sidebar-primary" id="sidebar-primary" role="complementary">
    <h1 class="screen-reader-text">Sidebar</h1>
    

    
    
    <section id="text-2" class="widget widget_text">
        <div class="textwidget">
            
            <div id="profile">
                <div id="profile_picture"><img src="https://www.lican.asia/logo/logo.png"></div>
                <div id="profile_intro">
                    <p><span class="name">Lican</span></p>
                    <p class="intro">全栈开发者，爱好造轮子。</p>
                </div>
            </div>
            
            <p>
                <script type="text/javascript">
                    (function ($) {
                        $(document).ready(function () {
                            var menuPrimaryContainer = $('#menu-primary-container');
                            var profile = $('#text-2');
                            $('#toggle-navigation').click(function () {
                                if (menuPrimaryContainer.hasClass('open')) {
                                    profile.removeClass('open');
                                } else {
                                    profile.addClass('open');
                                }
                            });
                        });
                    })(jQuery);
                </script>
            </p>
        </div>
    </section>
    
    
    
    
    
    <section id="text-5" class="widget widget_text">
        <h2 class="widget-title">开源项目</h2>
        <div class="textwidget">
            <div id="projects" style="line-height: 22px;">
                
                <a href="https://github.com/idoubi/gonews"
                    target="_blank">gonews</a>: &nbsp;Daily news for golang<br>
                
                <a href="https://github.com/idoubi/sql2struct"
                    target="_blank">sql2struct</a>: &nbsp;Generate go struct according to SQL<br>
                
                <a href="https://github.com/idoubi/goz"
                    target="_blank">goz</a>: &nbsp;Request library used in golang<br>
                
        </div>
    </section>
    
    

    
    
    
    
    <section id="qrcode" class="widget widget_media_image">
        <h2 class="widget-title">微信公众号</h2>
        <img width="258" height="258"
            src="https://www.lican.asia/wechat/lican.png"
            class="image wp-image-5514  attachment-full size-full" alt=""
            style="max-width: 100%; height: auto;"
            sizes="(max-width: 258px) 100vw, 258px">
    </section>
    
    

    
    
    

    
    
    

    
    
    
    
</aside>
            </div>
        </div>

        <footer id="site-footer" class="site-footer" role="contentinfo">
    <div class="max-width">
    </div>
    <div class="footer">
        <div id="footercontent">
            © lican.asia All rights reserved<br/>
            Built with Hugo Theme <a href="https://github.com/idoubi/hugo-theme-period" target="_blank">Period</a>
        </div>
    </div>
</footer>

<script>
    var _hmt = _hmt || [];
    (function() {
      var hm = document.createElement("script");
      hm.src = "https://hm.baidu.com/hm.js?e8351b6d4626d5881d439ea1f6184baa";
      var s = document.getElementsByTagName("script")[0]; 
      s.parentNode.insertBefore(hm, s);
    })();
</script>
    
    
    </div>
    
</body>

</html>